<?php
namespace app\validate;
use share\validate\SceneValidate;

class AliyunProductValidate extends SceneValidate{

    /**
     * 通用规则
     */
    protected $rule = [
        'id' => 'require|integer',
        'aliyun_project_id' => 'require|integer',
        'pk' => 'require|length:2,16',
        'ps' => 'length:2,16',
        'name' => 'require|length:2,50',
        'description' => 'length:2,100',
        'net_type' => 'length:2,50',
        'category' => 'length:2,50',
        'category_desc' => 'length:2,50',
        'has_aliyun_cloud_access' => 'require|integer',
    ];    

    /**
     * 自定义场景的规则
     */
    protected $sceneRules = [
        'list' =>[
            'id' => 'integer',
            'aliyun_project_id' => 'integer',
            'pk' => 'length:2,16',
            'ps' => 'length:2,16',
            'name' => 'length:2,50',
            'description' => 'length:2,100',
            'net_type' => 'length:2,50',
            'category' => 'length:2,50',
            'category_desc' => 'length:2,50',
        ],
    ];

    protected $scene = [
        'list' => ['id','aliyun_project_id','pk','ps','name','description','net_type','category','category_desc'],
        'set' => ['id','aliyun_project_id','pk','ps','name','description','net_type','category','category_desc','has_aliyun_cloud_access'],
        'del'  => ['id'],
    ];
}
